﻿
"""
SAGC (dis0.0.1+OSD1.9)
Author : SNOWARE(Yu Jiangmeng)
E-mail : SALflake(at)aliyun(dot)com
Web    : 
Date   : 4-May-2024
Url    : https://gitee.com/Ironbayberry/hopeSAGC
For any suggestions, leave a comment on
https://gitee.com/Ironbayberry/hopeSAGC
It helps the teacher call his students.
Usage : python3 main-S.py(At a classroom),or python3 main-T.py(As a teacher)
Licensed under Mozila Public License (MPL) 2.0.
You are free to modify this source.
CHANGELOG
================================================
Version dis0.0.1 (May 4, 2024)
-------------------------------------------------
- First Release
"""
import tkinter.messagebox,socket
import tkinter
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('127.0.0.1', 8085))
server.listen()
global decoded_data
while True:
    conn, addr = server.accept()
    string_data = conn.recv(1024)  # 接收最大1024字节的数据
    decoded_data = string_data.decode('utf-8')  # 将字节转换为字符串
    print(decoded_data)
    
    if decoded_data=="close!":
        break
    else:
        tkinter.messagebox.showwarning("警告",decoded_data)
